package main

type ListNode struct {
	Val  int
	Next *ListNode
}

/**
 *
 * @param pHead ListNode类
 * @return ListNode类
 */
func ReverseList(pHead *ListNode) *ListNode {
	// write code here
	var pre, nex *ListNode = nil, nil
	for pHead != nil {
		nex = pHead.Next
		pHead.Next = pre
		pre = pHead
		pHead = nex
	}
	return pre
}
